#include <stdio.h>

int jiecheng(int x)
{
    if(x < 0)
        return 0;

    if(x == 1)
        return 1;
        
    return x*jiecheng(x-1);
}

int main(int argc, char const *argv[])
{
    int n;
    printf("请输入要阶乘的值：\n");
    scanf("%d",&n);

    printf("结果是：%d\n",jiecheng(n));

    return 0;
}
